<template>
	<view>
		<view class="sign_conent_box">
			<view class="sign_conent">
				<view class="sign_conent_title">
					{{qdjl}}
				</view>
				<view class="ft12 mt10" style="color: #999;">{{$t('signin.giftmsg')}}</view>
				<view class="sign_list_aligns">
						<view class="scroll_view_items" v-for="(item, index) in sign_list" :key="index">
								<view class="scroll_view_item">
									<view class="ft12 mb5 cl-info">{{ item.day }}</view>
									<view class="scroll_view_item_img_box">
										<image v-if="item.xz==2" :src="statics.xuanzhong" class="scroll_view_item_img" mode=""></image>
										<image v-if="item.xz==1" :src="statics.yuanq" class="scroll_view_item_img" mode=""></image>
									</view>
									<view class="scroll_view_item_num">{{ item.discount }}</view>
									<view class="scroll_view_item_tips"></view>
								</view>
						</view>
				</view>
				<view class="sign_conent_btn" @click="cksigin()">{{$t('signin.submit')}}</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		sign_list: {},
		qdjl: 0,
		tdsy: 0,
	},
	data() {
		return {
			score_name:'积分'
		};
	},
	created(){
		this.score_name=uni.getStorageSync("config").site.score_name;
	},
	methods: {
		async cksigin() {
			if(uni.getStorageSync("userinfo")){
				let this_=this
				let data = {};
				data.tdsy=this.tdsy
				data.token = uni.getStorageSync("userinfo").token
				data.uid = uni.getStorageSync("userinfo").id
				let [err,res] =await this.$httpas.post('/api/user/qiandao',data);
				if (!this.$httpas.errorCheck(err,res)) return;
				if(res.data.code==1){
					uni.showModal({
						title: this_.$t('Warning'),
						content: res.data.msg,
						showCancel: false,
						success: res => {
							this_.$emit('cksigin')
						}
					});
				}else{
					uni.showToast({ title: res.data.msg,icon:"none" });
				}
			}else{
				uni.showModal({
					title: this_.$t('Warning'),
					content: this_.$t('Please login first'),
					showCancel: true,
					success: function (res) {
						if (res.confirm) {
							uni.navigateTo({
								url:'/pages/login/login'
							})						
						}
					}
				});
			}
		},
	}
};
</script>

<style lang="scss">
.sign_conent_box {
	width: 100%;
	display: flex;
	justify-content: center;
	margin-top: 30upx;
	.sign_conent {

		background: white;
		border-radius: 20upx;
		padding: 0upx 0upx;
		box-sizing: border-box;
		.sign_conent_title {
			width: 100%;
			font-size: 36upx;
			font-weight: bold;
			color: #333333;
			.sign_conent_title_span {
				color: #ff6526 !important;
			}
		}
		.sign_list_aligns {
			width: 100%;
			padding: 30upx 0 30upx 0;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
				.scroll_view_items {
					width: 120rpx;
					border: solid 1px #eeeeee;
					margin: 10rpx 18rpx;
					text-align: center;
					padding: 8rpx;
					border-radius: 8rpx;
				}
				.scroll_view_item {
					.scroll_view_item_img_box {
						width: 60upx;
						height: 60upx;
						position: relative;
						margin: 0 auto;
					}
					.scroll_view_item_num {
						font-size: 28rpx;
						color: orange;
					}
					.scroll_view_item_tips {
						text-align: center;
						font-size: 24upx;
						color: #333333;
					}
					.scroll_view_item_img {
						width: 60upx;
						height: 60upx;
						position: absolute;
						top: 0;
						left: 0;
						z-index: 0;
					}
				}
				.scroll_xian {
					width: 40upx;
					height: 4upx;
					background: #bfbfbf;
					margin-top: 30upx;
				}
		}
		.sign_conent_btn {
			width: 100%;
			border-radius: 45upx;
			background: linear-gradient(270deg, #FFAD03 0%, #FEC905 100%);
			color: #ffffff;
			text-align: center;
			padding: 22upx 0;
			font-size: 32upx;
		}
	}
}
</style>
